const express = require("express");
const createUploadMiddleware = require("../../middlewares/createUploadMiddleware");
const {
  upload,
  getBusinessIdList,
  deleteFileAttachmentById,
  getTeamOfVideo,
} = require("../../controllers/upload/attachmentController");
const router = express.Router();

const { singleFileUpload } = createUploadMiddleware();

/**
 * 附件上传
 * POST  /upload/attachments
 */
router.post("/", singleFileUpload("file"), upload);

/**
 * 获取附加列表
 * POST  /upload/attachments/businessIdList
 */
router.get("/businessIdList", getBusinessIdList);

/**
 * 获取视频文件流
 * POST  /upload/attachments/getTeamOfVideo
 */
router.get("/getTeamOfVideo", getTeamOfVideo);

/**
 * 删除附件及文件
 * POST  /upload/attachments/deleteFileAttachmentById
 */
router.delete("/deleteFileAttachmentById", deleteFileAttachmentById);

module.exports = router;
